package bit;

public class PowerOfTowDemo {
    public static void main(String[] args) {
        int n = 17;
        int m = -n;
        System.out.printf("%64s\n", Integer.toBinaryString(n));
        System.out.printf("%64s\n", Integer.toBinaryString(m));

        long x = 1L << 32;
        System.out.printf("%64s\n", Long.toBinaryString(x));
        long mn = x - n;
        System.out.printf("%64s\n", Long.toBinaryString(mn));
        System.out.printf("%64s\n", Long.toBinaryString(mn + n));

        if((n & (-n)) == n)
            System.out.println(n + " 是2的幂");
        else
            System.out.println(n + " 不是2的幂");

    }
}
